
from sklearn.linear_model import LinearRegression, SGDRegressor
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import mean_squared_error
import pandas as pd
import joblib

# 1.读取数据源
df = pd.read_csv("../data/house_data.csv")
# 2.选择特征和目标
X = df.iloc[:,:-1]
print(X.iloc[2].to_dict())
# y = df.MEDV
# # 3.拆分数据集
# X_train, X_test, y_train, y_test = train_test_split(
#     X, y, test_size=0.33, random_state=42)
#
# # 4.无量纲化--标准化
# scaler = StandardScaler()
# X_train = scaler.fit_transform(X_train)
# X_test = scaler.transform(X_test)
#
# # 5.训练模型
# lr = LinearRegression()
# lr.fit(X_train,y_train)
#
# # 6.保存模型
# joblib.dump(lr, "test.pkl")





